//Privacy INspector
// This is our javascript
window.addEventListener('load', function() {XSS.onLoad();}, false);

var XSS=
{
loaded: false,
urlbar: null,
go: null,
wireup: true,

 onLoad:function(){

if(!XSS.loaded)
{
XSS.loaded=true;

var httpRequestObserver = { 

observe: function(subject, topic, data) {

 if (topic == "http-on-modify-request") { 

var httpChannel = subject.QueryInterface(Components.interfaces.nsIHttpChannel);
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
var recentWindow = wm.getMostRecentWindow("navigator:browser");
var url=recentWindow.content.document.location;
if(url.host!=" "||url.host!="about:blank"||url.host!="about:config"||url.host!=""||url.host!=null)
{
var req = new XMLHttpRequest();
req.open('GET', 'http://www.google.com/search?q=site:'+url.host, true);
req.onreadystatechange = function (aEvt) {
  if (req.readyState == 4) {
     if(req.status == 200){

      var t=req.responseText;
if(t.indexOf("did not match any documents")!=-1)
alert("not found");
}
     else
      dump("Error loading page\n");
  }
}
req.send(null); 
}
if(url.match(/((\%3C)|<)((\%2F)|\/)*[a-z0-9\%]+((\%3E)|>)/)!=null){
alert("Possible XSS attack")
}
else if(url.match(/((\%3C)|<)((\%69)|i|(\%49))((\%6D)|m|(\%4D))((\%67)|g|(\%47))[^\n]+((\%3E)|>)/)!=null)
{
alert("Possible Image XSS attack");
}
else if(url.match(/((\%3C)|<)[^\n]+((\%3E)|>)/)!=null){
alert("Check ur Web APP , may be XSS attack");
}
XSS.wireup=false;



 }
 } 
}; 

var observerService= Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService);
observerService.addObserver(httpRequestObserver, "http-on-modify-request", false);

}

}
}
